package net.cyndeline.fov.mrpas

/**
 * A single row or column going from the orthogonal border inwards
 * towards the diagonal center of a quadrant.
 */
trait Line {
  
  /**
   * Length of the line.
   */
  def length: Int
  
  /**
   * Adds a new map position to this line.
   * @return True if the position was added, false if it was already present.
   */
  def addPosition(position: (Int, Int)): Boolean
  
  /**
   * A list of all tile positions along this line. The position closest 
   * to the border will always be first in the list, regardless of which
   * direction the line goes in on the map.
   */
  def tilePositions: List[(Int, Int)]
  
  /**
   * Adds an obstacle associated with a position already present in the line.
   * @return True if the obstacle were added, false if the specified position
   * 		 is already marked as an obstacle, or if the position isn't present.
   */
  def addObstacle(position: (Int, Int)): Boolean
  
  /**
   * Checks if a tile in a specified position contains an obstacle.
   */
  def isObstacle(pos: (Int, Int)): Boolean
  
  /**
   * Sets the total amount of obstacles found up to (but not including)
   * this line.
   */
  def obstaclesUpToThisLine_=(amount: Int)
  
  /**
   * The total amount of obstacles found up to (but not including)
   * this line.
   */
  def obstaclesUpToThisLine: Int
  
  /**
   * Returns the number of obstacles found in the part of a quadrant that
   * this line belongs to. The number only indicates the amount of obstacles
   * found up to and including this line.
   */
  def obstaclesFoundToThisLine: Int
}